[Tutor] (no subject)

2017-09-19 Thread C
Hi Python tutor, I require help for a script that asks user for number of rows, r and number of columns c, and generates a r x c matrix with the following values: - The value of each element in the first row is the number of the column - The value of each element in the first column is the number

[Tutor] Creating A Simple Blog System Using Python Programming

2010-06-26 Thread F C
Hi there, - I have recently decided to learn Python. - It is my first programming language. - I am new to programming. - I know XHTML and CSS, and a few lines of PHP. - I only started learning a couple of days ago. What I want to do is create a simple blog system. Where I can - create posts

[Tutor] Help with choices for new database program

2010-07-02 Thread Chris C.
Hi, I'm not a programmer, but I have been exposed to some programming basics. I've written small parts of console-based C++ programs in an OOP class I took last year (but nothing outside of the classroom setting), and on my own I've written some semi-simple multi-form multi-repo

[Tutor] short circuiting

2009-06-25 Thread Dave C
Hi I've read that the builtin all() function stops evaluating as soon as it hits a false item, meaning that items after the first false one are not evaluated. I was wondering if someone could give an example of where all()'s short circuiting is of consequence, akin to: False and produces_side_eff

[Tutor] Re: Printing two elements in a list

2004-12-19 Thread C Smith
te is at index 1 and the 2 that was at position 1 is now at position 0 An alternative is to use a list comprehension, keeping only the elements that are not 2. As is shown, you can replace the list you are filtering with the filtered result: ### >>> b=[2,2,1,1] >>> b=[x for x in b if not(x==2)] >>> b [1, 1] ### /c ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

[Tutor] working with new classes

2005-03-08 Thread C Smith
zero = 0 def turn(self, incr=1): self._zero+=incr def __getitem__(self, i): return self[(i-self._zero)%len(self)] l=Ring(range(10)) print l l.turn(5) print l #same as original print l[0] #crashes python ### /c ___

Re: [Tutor] working with new classes

2005-03-09 Thread C Smith
l.turn(3); print l [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 1, 2] >>> >>> l.segment(17,5,3) #start at 17, length of 5, stride 3 [0, 3] ### This is my first intoduction to the new class modifications...initially it seems nice to be able to wrap your

Re: [Tutor] help

2005-03-13 Thread C Smith
learn how to "say things" in general. Python is a nice language to work with in this regard. /c ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] creating a tab delimited filename

2005-03-15 Thread C Smith
On Tuesday, Mar 15, 2005, at 05:01 America/Chicago, [EMAIL PROTECTED] wrote: how am i going to change the filename automaticaly? for example: #every 5 minutes, i am going to create a file based on the data above for i in range(100) output_file = file('c:/output'

Re: [Tutor] creating a tab delimited filename

2005-03-16 Thread C Smith
0, 1, and 2: ### >>> j=0 >>> for i in range(10): .. print j .. j = (j+1)%3 .. 0 1 2 0 1 2 0 1 2 0 ### /c ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] primes

2005-03-17 Thread C Smith
e a dramatic time reduction: ### import math big=5 [x for x in xrange(2,big) if not [y for y in range(2,int(math.sqrt(x)+1)) if x%y==0]] ### /c ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Looking for a Pythonic way to pass variable

2005-03-22 Thread C Smith
On Tuesday, Mar 22, 2005, at 05:01 America/Chicago, [EMAIL PROTECTED] wrote: I met a similar question. what if one has L = [[1,2],[3,4]], K = [100, 200] How to 'zip' a List like [[1,2,100], [3,4,200]]? I would do something like: ### for i in range(len(L)): L[i].append(K[

Re: [Tutor] primes - sieve of odds

2005-03-22 Thread C Smith
mum+1,2) nums[0] = None for p in nums: if p: if p > limit: break nums[(p*p)//2::p] = [False]*(1+(maximum//p- p)//2) nums[0] = 2 return filter(None, nums) ### /c Hi Sean! Thanks for your measurements. In the meantime I did another amendment, l

[Tutor] What does Python gain by having immutable types?

2005-03-22 Thread Tony C
A friend recently asked my this didn't modify his original string variable s1="this is a string" s1.replace("is a", "is a short") "this is a short string" print s1 "this is a string" After showing him to change it to this s1 = s1.replace("is a", "is a short") print s1 "this is a short string"

Re: [Tutor] primes - sieve of odds

2005-03-23 Thread C Smith
up to 1,000,000. I'll leave it to someone else to see when it finally blows up :-) The output of primes was checked through 1,000,000 against Eppstein's generator without error. /c ### def esieve(): '''extended sieve generator that returns primes on each call. When the end of

Re: [Tutor] primes - sieve of odds

2005-03-23 Thread C Smith
sted could do with the same memory. It's a "tortoise and hare" race as the memory gets chewed up by the esieve approach. The ASPN version of Eppstein's program is an older one than the one at the following site: http://www.ics.uci.edu/~eppstein/PADS/Er

Re: [Tutor] Float precision untrustworthy~~~

2005-03-29 Thread C Smith
t exact anyway -- i.e. sqrt(2) Wish granted in version 2.4 ;-) I don't have it on the mac, but there is a write-up at http://www.python.org/doc/2.4/whatsnew/node9.html The starting blurb says: "Python has always supported floating-point (FP) numbers, based on the underlying C double t

[Tutor] Re: If elif not working in comparison

2005-03-29 Thread C Smith
are represented as numbers smaller than their mathematical counterparts: ### >>> 2.9 2.8999 ### If you have Python 2.4 you might want to check out the decimal type that is now part of the language. There is a description at http://www.python.org/doc/2.4/whatsnew/node9.html wh

Re: [Tutor] Math Question

2005-03-29 Thread C Smith
. print pi .. (2, [1, 1]) (3, [1, 2]) (4, [1, 3]) (4, [2, 2]) (5, [2, 3]) (6, [3, 3]) >>> ### Just a thought, /c ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread C Smith
>>> time() 1112306900.8461709 ### If you import the whole module, though, and try the same thing... ### >>> import time >>> time() Traceback (most recent call last): File "", line 1, in ? TypeError: 'module' object is no

Re: [Tutor] one line code

2005-04-04 Thread C Smith
t >>> [(type(x)==int and [float(x)] or [x])[0] for x in l] ['foo', 0.0] >>> # ok, that's better ### /c ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] str.split and quotes

2005-04-06 Thread C Smith
s.extend(si.split()) else: s.append(si) print s ### OUTPUT: ['Hi', 'there', 'Python Tutors', 'please', 'help', 'me'] /c ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] flatten

2005-04-07 Thread C Smith
? (Does that make sense?) After searching for "Tim Peters flatten" I was able to find a similar routine at http://sourceforge.net/project/ showfiles.php?group_id=87034&package_id=90541&release_id=288585 (It is in the basictypes folder in the latebind.py script by Mike C. Fletch

Re: [Tutor] str.split and quotes

2005-04-08 Thread C Smith
een quote marks: in '"this" and "that"' the entire string will be matched rather than the first "this". The fix is to use the non-greedy pattern:   re.compile(r'\".*?\"|[^ ]+')   Note the ? after the *   /c     ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Flatten

2005-04-11 Thread C Smith
The one I presented is essentially the same as Fletcher's. Fletcher's does not actually run through all indices as I thought: as soon as it steps on an out-of-range index it exits. Fletcher's routine is a non-recursive version that runs in

Re: [Tutor] Sorting of files based on filesize

2005-04-11 Thread C Smith
into sublists that are close to 2X your disk capacity would be to generalize the algorithm to break the numbers into M groups rather than 2 groups...but I'm not sure how easy that will be. You're going to love using the karp for this problem :-) /c ___

[Tutor] Getting started

2005-07-20 Thread Brett C.
Which Python version should I download, I have Windows XP and am just getting started in the programming area so alot of the descriptions are to confusing for me to understand, anyhelp would be appreciated ___ Tutor maillist - Tutor@python.org http:

[Tutor] trying to figure out what this means

2007-05-07 Thread Dave C
when you are doing print these two characters keep showing up in this book "%s" % What do they do? here is example of complete command. print "%s" % last_names[-2] Thank you, Dave ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailma

[Tutor] help with list permutations

2008-01-03 Thread c t
Greeting from a real newbie, I think that their might exist an easy way, in Python, for my list permutation issue. I need to be able to permute all elements from across several lists, while ensuring order is maintained across the lists. For example: list1=[a b] list2=[c d e] list3=[f] list4

[Tutor] Should I use generators here?

2006-05-07 Thread Tony C
I wrote a small Python program to count some simple statistics on a Visual Basic program thatI am maintaining.The Python program counts total lines, whitespace lines, comment lines, Public & Private Subroutines, Public and Private Functions. The Python program takes about 20-40 seconds to count all

Re: [Tutor] Should I use generators here?

2006-05-08 Thread Tony C
Thus you should probably do:   try:   fh=open(Onefile, "r")   Filecontents = fh.readlines()  # these files are verysmall,   # other code here   Summary[Onefile] = deepcopy(Stats)# associate each   fh.close()   except IOError:   print("\n

[Tutor] How do I compile Python for people so they don't have to download?

2007-02-15 Thread C. Gander
I downloaded py2exe and I thought it was a program that you just browsed your driver and gave it the .py file and it would do the rest. But I downloaded it and I cannot figure out how to use it. Please help. _ Get in the mood for Va

[Tutor] how obsolete is 2.2?

2011-09-07 Thread c smith
pickle deserialize things that were not serialized by python? can it convert data into a python data type regardless of it was originally a 'c array' or something else that python doesn't support? ___ Tutor maillist - Tutor@python.

[Tutor] how obsolete is 2.2, and a pickle question

2011-09-07 Thread c smith
pickle deserialize things that were not serialized by python? can it convert data into a python data type regardless of it was originally a 'c array' or something else that python doesn't support? ___ Tutor maillist - Tutor@python.

[Tutor] making lists of prime numbers

2011-09-14 Thread c smith
hi list, i am trying the MIT opencourseware assignments. one was to find the 1000th prime. since this isn't actually my homework, I modified the solution as I would like to collect lists of primes and non-primes up to N, also some log() ratio to one comparison. here is what I came up with on paper:

[Tutor] help with a recursive function

2011-09-27 Thread c smith
hi list, i understand the general idea of recursion and if I am following well written code I can understand how it works, but when I try to write it for myself I get a bit confused with the flow. I was trying to turn an ackerman function into python code for practice and I tried writing it like th

Re: [Tutor] Running a script in the background

2012-09-01 Thread c smith
You are thinking of && & is what you want ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] html checker

2012-10-01 Thread c smith
You will not find much help in getting a program to 'just work' regardless of your own experience. My advice would be to try and run small parts at a time to pinpoint where the problem is. Are you opening and reading the file properly? Are you iterating over the read file properly? Does your html c

Re: [Tutor] html checker

2012-10-01 Thread c smith
yourlisthere.pop() will return the last element in the list and change the list so it no longer contains the element. yourlisthere.push(x) will add x to the end of the list. Works on more than just lists ___ Tutor maillist - Tutor@python.org To unsubscr

Re: [Tutor] HELP!

2012-10-01 Thread c smith
Is the only problem that your code is giving unexpected results, or that it doesnt run or what? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] python help?

2012-10-01 Thread c smith
It is hard to see things like images and attachments. I think purely html is preferred, but i would have to look over 'the list rules' again. You should look into dictionaries as the structure to hold your info. ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Filename match on file extensions

2012-10-02 Thread c smith
Would this be a time when regex is necessary? Maybe: \b[^.]*quarantine[^.]*\.[a-zA-Z]*\b ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What can I do if I'm banned from a website??

2012-10-10 Thread c smith
how could someone know enough to write their own web-scraping program and NOT know that this is not about python or how to get around this problem? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.o

Re: [Tutor] Python type confusion?

2015-09-28 Thread C Smith
On Mon, Sep 28, 2015 at 1:27 PM, Ken Hammer wrote: > A simple "type" problem? > > The following code works as a py file with the XX'd lines replacing the two > later "raw_input" lines. > Why do the "raw_input" lines yield a TypeError: 'str' object is not callable? > Same result if I use/omit >

Re: [Tutor] Python type confusion?

2015-09-28 Thread C Smith
On Mon, Sep 28, 2015 at 4:13 PM, C Smith wrote: > On Mon, Sep 28, 2015 at 1:27 PM, Ken Hammer wrote: >> A simple "type" problem? >> >> The following code works as a py file with the XX'd lines replacing the two >> later "raw_input" lines. >

Re: [Tutor] Mutable data type in python

2015-10-03 Thread C Smith
> Here is my modified version which I think works as you want: > > def findMinDepthPath(n): > if n <= 0: raise ValueError > elif n==1: > return 0 > elif n==2 or n==3: > return 1 > else: > d1 = findMinDepthPath(n-1)+1 > d2 = d3 = (d1+1) # initialize to

Re: [Tutor] Mutable data type in python

2015-10-03 Thread C Smith
On Sat, Oct 3, 2015 at 11:55 AM, Alan Gauld wrote: > On 03/10/15 19:10, C Smith wrote: >>> >>> Here is my modified version which I think works as you want: >>> >>> def findMinDepthPath(n): >>> if n <= 0: raise ValueError >>>

Re: [Tutor] Python code

2016-11-25 Thread Juan C.
On Thu, Nov 24, 2016 at 9:14 PM, urfa jamil wrote: > > I need help to write a code for this problem. > > Please help > > > Ask the user to enter a series of numbers. Stop reading numbers when they enter a negative number. Calculate the average of the numbers given not including the final negative

[Tutor] Help on Software Design decisions

2016-11-28 Thread Juan C.
I'm a student and my university uses Moodle as their learning management system (LMS). They don't have Moodle Web Services enabled and won't be enabling it anytime soon, at least for students. The university programs have the following structure, for example: 1. Bachelor's Degree in Computer Scien

Re: [Tutor] Help on Software Design decisions

2016-11-29 Thread Juan C.
On Mon, Nov 28, 2016 at 11:33 PM, Alan Gauld via Tutor wrote: > > On 28/11/16 21:53, Juan C. wrote: > > I'm a student and my university uses Moodle as their learning management > > system (LMS). > > Never heard of it but hopefully that doesn't matter :-) >

Re: [Tutor] Help on Software Design decisions

2016-11-29 Thread Juan C.
On Tue, Nov 29, 2016 at 7:12 AM, Alan Gauld via Tutor wrote: > I just noticed the last bit. > Is this a client side API or a server side API? > In other words are you building a set of services on the > server or are you building a module that makes it easy > for client side programs to access the

Re: [Tutor] Ran into a problem: Tried many different methods

2016-11-30 Thread Juan C.
On Wed, Nov 30, 2016 at 12:29 AM, Parish Watteau wrote: > A program that will read each player’s name and golf score as > keyboard input, and then save these as records in a file named golf.txt. > (Each record will have a field for the player’s name and a field for the > player’s score.)

Re: [Tutor] (no subject)

2016-12-14 Thread Juan C.
On Dec 10, 2016 12:15 PM, "Tetteh, Isaac - SDSU Student" > isaac.tet...@jacks.sdstate.edu> wrote: > > > > Hello, > > > > I am trying to find the number of times a word occurs on a webpage so I > used bs4 code below > > > > Let assume html contains the "html code" > > soup = BeautifulSoup(html, "htm

Re: [Tutor] Created Function, Need Argument to be a String

2016-12-17 Thread Juan C.
On Mon, Dec 12, 2016 at 2:29 PM, Bryon Adams wrote: > Is there a way to force my argument to always be a string before entering > the function? You could do the following: 1. Use `def ip_checker(ip_address: str):` to make it more clear that you're expecting a str, but remember, this is just a "h

Re: [Tutor] Using venv

2017-02-04 Thread Juan C.
wn in two situations: 1. No virtualenv 1.a. You only have one Lib/site-packages to hold all your packages 1.b. Project A uses package-abc 1.2 while Project B uses package-abc 1.5 1.c. You go to work on Project B using package-abc 1.5, but later on you have to do some changes on Project A so you must

Re: [Tutor] Difficulty in getting logged on to python.org; want to resubscribe at the beginner level; finding "While" Loops in Python 3.4.0 to be extremely picky

2014-04-25 Thread C Smith
You can get python 3.4 to work on your mac, but it has 2.5 or 2.4 which the OS uses and things can get very messed up if you don't know what you are doing. You should use virtualbox to run virtual OS's on your mac without messing up your main computer. You should probably describe what kind of err

Re: [Tutor] Help needed

2014-04-26 Thread C Smith
; 3. I calculate the total "probability of failure" of each path (a path may > have multiple links): Suppose my source node is "a" and destination node is > "b". I can setup a path between a to b via c or via d (a-c-b or a-d-c): > Here I will check the risk va

Re: [Tutor] Help needed

2014-04-26 Thread C Smith
err, set also is unordered. I can see you are using set for a reason, but has no concept of order. On Sat, Apr 26, 2014 at 3:20 PM, C Smith wrote: > Just glancing at your work, I see you have curly braces around what looks > like it should be a list. If you are concerned with the order o

Re: [Tutor] Help needed

2014-04-26 Thread C Smith
ere is some other function that can be used to > display the output in desired order but don't see it possible thats why was > wondering if any of you Python gurus have any inputs for me :-) > > > > On Sat, Apr 26, 2014 at 12:36 PM, C Smith wrote: > >> err, set also

Re: [Tutor] converting strings to float: strange case

2014-04-28 Thread C Smith
.split() will split things based on whitespace or newlines. Do you know that your file is only going to contain things that should convert to floats? If you post your entire code, the error you have included will be more helpful as it points to a certain line. The last line in your code has (stri)

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread C Smith
That is definitely more useful information in answering your questions. Whenever you see the error you are getting: NameError: name 'smv_guessNumber' is not defined That means you are using a variable, in this case 'smv_guessNumber', that has not been created yet. The reason this is happening he

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread C Smith
I should probably clarify that this list is mainly for python2.7, correct me if I am wrong. On Mon, Apr 28, 2014 at 1:49 PM, C Smith wrote: > That is definitely more useful information in answering your questions. > Whenever you see the error you are getting: > > Nam

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread C Smith
The reason this is happening here is you need to import sys. > I don't know why you would think importing sys would fix this. docs say it accepts from sys.stdin On Mon, Apr 28, 2014 at 1:55 PM, Philip Dexter wrote: > > > On Mon, 28 Apr 2014, C Smith wrote: >

Re: [Tutor] Stephen Mik-Almost Brand New to Python 3.4.0-"Guess My Number" program is syntactically correct but will not run as expected

2014-04-28 Thread C Smith
, 2014 at 1:59 PM, C Smith wrote: > > > The reason this is happening here is you need to import sys. >> > > I don't know why you would think importing sys would fix this. > > docs say it accepts from sys.stdin > > > On Mon, Apr 28, 2014 at 1:55 PM,

[Tutor] Fwd: Logical error?

2014-05-02 Thread C Smith
The first loop tests for the last element of fullPath to have today's date. The second loop tests the first element in fullPath, if it is not today, you will end up running sys.exit() when you hit the else clause in second loop. On Fri, May 2, 2014 at 6:38 PM, C Smith wrote: > The fi

[Tutor] append vs list addition

2014-05-04 Thread C Smith
I had always assumed that append() was more efficient, but some recent discussions seem to point at that it is the same as append(). Which is preferable and why? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https:

Re: [Tutor] append vs list addition

2014-05-04 Thread C Smith
Sorry. I meant for example: list1 = [1,2,3] list2 = [3,4,5] newList = list1 + list2 versus for x in list2: list1.append(x) Which is the preferred way to add elements from one list to another? On Sun, May 4, 2014 at 7:36 AM, Dave Angel wrote: > C Smith Wrote in message: >> &

Re: [Tutor] Stephen Mik-Novice Python Programmer(Version 3.4.0)Can't get help using Dictionaries, Lists to 'Hangman Game Problem"

2014-05-04 Thread C Smith
Hey, you will want to include some code to show your progress so far. Can you write a basic program and then work the requirements into it? Do you have some idea of where to start? Are you supposed to modify a completed version of "hangman" that is in your text, or come up with an original 'hangman

Re: [Tutor] Alice_in_wonderland Question

2014-05-04 Thread C Smith
>ordered_keys = word_count.keys() >sorted(ordered_keys) sorted() does not modify the list, but returns a sorted version of the list for me on Python 2.7 my_sorted_list = sorted(ordered_keys) This will alphabetize all of the words, regardless of frequency. >print ("All the words and their frequenc

Re: [Tutor] Stephen Mik-Novice Python Programmer(Version 3.4.0)Can't get help using Dictionaries, Lists to 'Hangman Game Problem"

2014-05-05 Thread C Smith
ode, pseudo code,worries about > using Dictionaries,Lists.embedded while lists,for loops: > Thank you,. C. Smith for responding to my help plea on Python-Tutor.org. One > version of the "Hang Man" problem is listed in the textbook,but it doesn't > use Dictionaries,Lists,embedded w

[Tutor] How inefficient is this code?

2014-05-07 Thread C Smith
A topic came up on slashdot concerning "intermediate" programming, where the poster expressed the feeling that the easy stuff is too easy and the hard stuff is too hard. Someone did point out that 'intermediate' programming would still involve actually selling code or at least some professional ex

Re: [Tutor] How inefficient is this code?

2014-05-07 Thread C Smith
eturn (or reaches the end of its body), the > for loop ends. > > This is called a generator function, and is a really nice way to > simplify and optimize your loops. > > You can read more about generators here: > https://wiki.python.org/moin/Generators > > > On Wed,

Re: [Tutor] How inefficient is this code?

2014-05-07 Thread C Smith
I guess intuiting efficiency doesn't work in Python because it is such high-level? Or is there much more going on there? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help with Python

2014-05-11 Thread C Smith
Hey Glen, include the error you are getting. It will make answering your question easier. How are you running this program, in an IDE? On Sat, May 10, 2014 at 11:16 PM, Glen Chan wrote: > Hello, I am a student trying to figure out Python. I am getting errors that > I don't know how to fix. What d

[Tutor] Real world experience

2014-05-11 Thread C Smith
I have never known anyone that works in this industry. I got one job transforming xml (should have used xslt, ended up using sed and python regex scripts) where the guy asked me how much I wanted and I threw 200 bucks out there because I could get a room for two weeks at that cost. He just laughed

Re: [Tutor] Real world experience

2014-05-11 Thread C Smith
to the industry. > > If you want to pursue a career in IT, you need to finish high school. You > would be wise to get a degree. > > My $0.02. > > Tim > > > On Sun, May 11, 2014 at 7:12 PM, C Smith > wrote: >> >> I have never known anyone that works i

Re: [Tutor] Real world experience

2014-05-12 Thread C Smith
Thanks to everyone. >> practice. That programming doesn't have to be a solitary thing needs >> to be strongly emphasized, because the media likes to exaggerate, >Yes, This can't be stressed too much. Industrial coding is a team activity not >a solo process. This is particularly good advice for

Re: [Tutor] Real world experience

2014-05-12 Thread C Smith
Freeside is more makers. I haven't gone but have known people that have. You might find some arduino supposedly, but not much coding otherwise and you have to pay membership fees. It is more social than technical, I think. And your car will probably be broken into. I will check out the python-atlan

Re: [Tutor] Real world experience

2014-05-12 Thread C Smith
I think that is going to be my new wallpaper. On Mon, May 12, 2014 at 8:25 PM, Martin A. Brown wrote: > > Hello, > > 10 Pick one favorite specific topic, any topic (XML parsing; Unix > process handling; databases). The topic matters for you. > Learn it deeply. Keep learning it. The

Re: [Tutor] for the error about 'import site' failed; use -v for traceback

2014-05-14 Thread C Smith
That looks pretty normal. I don't see any errors. On Wed, May 14, 2014 at 5:42 AM, Tao Zhu wrote: > Hi everyone, > when I use python, the problem occured. when I used the command "python -v", > the results are listed as follows. could you tell me what wrong? > > $ python -v > # installing zipimpo

Re: [Tutor] for the error about 'import site' failed; use -v for traceback

2014-05-14 Thread C Smith
What are you trying to do? On Wed, May 14, 2014 at 12:24 PM, C Smith wrote: > That looks pretty normal. I don't see any errors. > > On Wed, May 14, 2014 at 5:42 AM, Tao Zhu wrote: >> Hi everyone, >> when I use python, the problem occured. when I used the command "

Re: [Tutor] Translator - multiple choice answer

2014-05-14 Thread C Smith
This might be useful for reading values from a text value into a dictionary: https://stackoverflow.com/questions/17775273/how-to-read-and-store-values-from-a-text-file-into-a-dictionary-python On Wed, May 14, 2014 at 7:00 PM, Danny Yoo wrote: >> Program read TXT file (c:\\slo3.txt) >

Re: [Tutor] While truth

2014-05-20 Thread C Smith
You can test out a condition like this in IDLE like so: while 6: print "yes its true" break while 0: print "yes its true" break while -1: print "yes its true" break emptyList = [] while emtpyList: print "yes its true" break This way you don't have to deal with

Re: [Tutor] While truth

2014-05-20 Thread C Smith
Of course that isn't very useful code. I thought it might be a useful quick test for someone learning how while loops treat different values. On Tue, May 20, 2014 at 2:46 PM, Danny Yoo wrote: > On Tue, May 20, 2014 at 11:44 AM, C Smith > wrote: >> You can test out a condition

Re: [Tutor] Doubts about installing python3.1 in squeeze

2014-05-22 Thread C Smith
Sorry, typing is hard. *You will need to use virtualenv On Thu, May 22, 2014 at 2:40 PM, C Smith wrote: > You can't use apt-get or similar to install 3.1. > You will need to virtualenv. > > On Thu, May 22, 2014 at 12:22 PM, Alex Kleider wrote: >> On 2014-05-22 06:17, M

Re: [Tutor] Doubts about installing python3.1 in squeeze

2014-05-22 Thread C Smith
You can't use apt-get or similar to install 3.1. You will need to virtualenv. On Thu, May 22, 2014 at 12:22 PM, Alex Kleider wrote: > On 2014-05-22 06:17, Markos wrote: >> >> Hi, >> >> I'm learning Python and I'm using Debian 6.0 (squeeze) >> >> The installed version is 2.6.6. (python -V) >> >> I

Re: [Tutor] What are your favourite unofficial resources

2014-06-30 Thread C Smith
Learning Python Design Patterns, by Gennadiy Zlobin Let us know when your book is done! On Mon, Jun 30, 2014 at 7:05 AM, Bob Williams wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 29/06/14 23:41, Alan Gauld wrote: >> I'm looking for tips for an appendix to a book that I'm workin

Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-05 Thread C Smith
I agree very much. I feel like I might have a learning disability when I try to reference the official Python docs for something that seems like it should be a very common task. On Sat, Jul 5, 2014 at 1:31 PM, Deb Wyatt wrote: > I am betting that a big reason newbies don't go straight to document

[Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
I am on OSX, which needs to escape spaces in filenames with a backslash. There are multiple files within one directory that all have the same structure, one or more characters with zero or more spaces in the filename, like this: 3 Song Title XYZ.flac. I want to use Python to call ffmpeg to convert

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
passed to the shell without escaping the spaces. >Why not using ffmpeg without jumping into Python. It's well documented, check >Google. I guess you mean that the ability to change multiple files with ffmpeg is possible. I hadn't considered that but I would rather do it with Python,

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
e Python interpreter strip off backslashes or something with strings? On Thu, Jul 31, 2014 at 5:53 PM, C Smith wrote: >>Change: > > >>subprocess.call(['ffmpeg', '-i', filename, str(track)+'.mp3']) > >>to: > >>subprocess.call(['ffmpeg

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
Okay I messed up with slash instead of backslash, so the re.sub() works, but I am still curious about the previous question. On Thu, Jul 31, 2014 at 6:14 PM, C Smith wrote: > Even when I am using: > re.sub('/s', '\\/s', filename) > I am still getting the same outp

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
. So, I am still wondering about that too. On Thu, Jul 31, 2014 at 6:20 PM, C Smith wrote: > Okay I messed up with slash instead of backslash, so the re.sub() > works, but I am still curious about the previous question. > > On Thu, Jul 31, 2014 at 6:14 PM, C Smith wrote: >> Ev

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
> emails are coming in slowly and out of order, but I have a suggestion: > > On Thu, Jul 31, 2014 at 03:53:48PM -0400, C Smith wrote: >> I am on OSX, which needs to escape spaces in filenames with a backslash. > > Same as any other Unix, or Linux, or, indeed, Windows. > >

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
woops, I see it pathname != filename On Thu, Jul 31, 2014 at 6:55 PM, C Smith wrote: >>for track, filename in enumerate(os.listdir(directory), 1): > It seems kinda counter-intuitive to have track then filename as > variables, but enumerate looks like it gets passed the filename

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
Works now, thanks! On Thu, Jul 31, 2014 at 6:57 PM, C Smith wrote: > woops, I see it pathname != filename > > On Thu, Jul 31, 2014 at 6:55 PM, C Smith wrote: >>>for track, filename in enumerate(os.listdir(directory), 1): >> It seems kinda counter-intuitive to hav

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
Huh, that is quite an annoyance about changing the order though. Any ideas about that? I will look into it further in the meantime... On Thu, Jul 31, 2014 at 6:57 PM, C Smith wrote: > Works now, thanks! > > On Thu, Jul 31, 2014 at 6:57 PM, C Smith wrote: >> woops, I see it pathn

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
thanks, got it import os, subprocess, re directory = 'abs/path' for track, filename in enumerate(os.listdir(directory), 1): pathname = os.path.join(directory, filename) subprocess.call(['ffmpeg', '-i', pathname, filename+str(track)+'.mp3']) On Thu,

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
or more accurately import os, subprocess, re directory = '/abs/path' for track, filename in enumerate(os.listdir(directory), 1): pathname = os.path.join(directory, filename) subprocess.call(['ffmpeg', '-i', pathname, filename[:-5]+'.mp3']) On Thu,

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread C Smith
wrote: > C Smith wrote: > > I'd throw in a check to verify that filename is indeed a flac: > >> or more accurately >> import os, subprocess, re >> directory = '/abs/path' >> for track, filename in enumerate(os.listdir(directory), 1): >&

  1   2   3   4   >