Sorry, guys. Accidentally replied off-list.
--- Begin Message ---
Kirk Bailey wrote:
ok, try this:
Try:
You're still using an uppercase try. Python is case sensitive. Unless
you're doing some voodoo magic to make
Try be an alias for try, this won't work.
filename=sys.arv[1]
exc
ok, try this:
Try:
filename=sys.arv[1]
except Exception, e:
if filename='':
filename='foo' # define a default value
else:
if foo: # detect one likely error
foobarcode
else:
Alan,
What you mistook for "vim 8" (with some garbage afterward) was in fact a smiley
I use frequently.
-Robert
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
"Robert H. Haener IV" <[EMAIL PROTECTED]> wrote
>, I may have to stop coding Python in vim 8?}
vim 8?!!
I didn't hardly notice that vim 7 was out!
Time for an upgrade I guess...
Alan G
___
Tutor maillist - Tutor@python.org
http://mail.python
Kirk Bailey wrote:
> Teresa Stanton wrote:
>
>> If one argument to a script is provided I am to take the input from it.
>> I figure that is presented like this:
>>
>> filename = sys.argv[1]
>>
> Try:
>
the 'try' keyword is not capitalized in Python.
> filename=sys.arg[1]
> except
<[EMAIL PROTECTED]> wrote
>> i have a long stream of data, represented in hexadecimal
>> form. I need to split it in bytes (by 2 chars each). eg
>> '00010203040506'... -> ['00', '01, '02' ...].
>>
>> So my question is: is there an inverse function of zip, or
>> an easy way to split this long s
Alan Gauld wrote:
> "Dick Moores" <[EMAIL PROTECTED]> wrote
>
>> lstNums = []
>> for x in lstSvg:
>> num = int(x.split('.')[0])
>> lstNums.append(num)
>
> This is exactly what a list comp does so you could rewrite it as:
>
> lstNums = [int(x.split('.')[0]) for x in lstSv
At 08:19 AM 4/9/2007, Alan Gauld wrote:
>"Dick Moores" <[EMAIL PROTECTED]> wrote
>
> > lstNums = []
> > for x in lstSvg:
> > num = int(x.split('.')[0])
> > lstNums.append(num)
>
>This is exactly what a list comp does so you could rewrite it as:
>
>lstNums = [int(x.split('.')
Never mind, SPE answered my question for me. Heh, I may have to stop coding
Python in vim 8?}
-Robert
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hey folks, I just need to know if shutil.copy2() will accept a directory as the
destination or if I have to supply a full path including the name of the file
(e.g. "C:\foo\bar.txt" as opposed to "C:\foo\"). The target is 32-bit Windows
XP with Python 2.5.
-Robert
_
<[EMAIL PROTECTED]> wrote
> i have a long stream of data, represented in hexadecimal
> form. I need to split it in bytes (by 2 chars each). eg
> '00010203040506'... -> ['00', '01, '02' ...].
> So my question is: is there an inverse function of zip, or
> an easy way to split this long string in p
Kent Johnson wrote:
> Andreas Pfrengle wrote:
>
>> # Accessing db (see http://www.djangoproject.com/documentation/db-api/):
>> myobj = MyModel.objects.get()
>> var = myobj.vector
>> # vector is a Textfield, so var now contains a string, naming another
>> db-field of myobj
>>
>> execstr = "attr =
Andreas Pfrengle wrote:
> # Accessing db (see http://www.djangoproject.com/documentation/db-api/):
> myobj = MyModel.objects.get()
> var = myobj.vector
> # vector is a Textfield, so var now contains a string, naming another
> db-field of myobj
>
> execstr = "attr = myobj." + var
> exec execstr
>
hi list,
i have a long stream of data, represented in hexadecimal
form. I need to split it in bytes (by 2 chars each). eg
'00010203040506'... -> ['00', '01, '02' ...].
So my question is: is there an inverse function of zip, or
an easy way to split this long string in pairs (without
indexing in cyc
Bob Gailer wrote:
> Andreas Pfrengle wrote:
>
>> [snip]
>
>> looks good if I'm happy with my values inside mydict and don't want
>> to have sth. like x=5 in the end. But since 'x' is the name of a
>> database field (I simplified it here for an example), I still see no
>> way around the exec, so
"Dick Moores" <[EMAIL PROTECTED]> wrote
> lstNums = []
> for x in lstSvg:
> num = int(x.split('.')[0])
> lstNums.append(num)
This is exactly what a list comp does so you could rewrite it as:
lstNums = [int(x.split('.')[0]) for x in lstSvg]
One of the cases where I actua
At 03:39 AM 4/9/2007, Kent Johnson wrote:
>Dick Moores wrote:
>>Sorry if my Subject line isn't clear about what my question is.
>>I have a script that uses the turtle and random modules to create
>>SVG files, one after another, in a directory just for the SVGs. The
>>script assigns filenames in t
On 4/8/07, linda.s <[EMAIL PROTECTED]> wrote:
> how i can randomly reassign the values to different location in the list?
>>> import random
>>> mylist = [1,2,3,4,5,6,7,8,9]
>>> mylist
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> random.shuffle(mylist)
>>> mylist
[3, 6, 9, 4, 7, 1, 2, 8, 5]
--
- Rikard - ht
On 4/7/07, János Juhász <[EMAIL PROTECTED]> wrote:
May you recommend anything to build them easy ?
I use this C-shell script for the same purpose. Even if it doesn't add
up to the features you want, you can always use it as reference for
re-hacking.
--
- Rikard - http://bos.hack.org/cv/
ma
Dick Moores wrote:
> Sorry if my Subject line isn't clear about what my question is.
>
> I have a script that uses the turtle and random modules to create SVG
> files, one after another, in a directory just for the SVGs. The
> script assigns filenames in the form, "n.svg", where n is an integer.
Andreas Pfrengle wrote:
> Bob Gailer wrote:
>
>> Andreas Pfrengle wrote:
>>
>>> Hello,
>>>
>>> I want to change the value of a variable whose name I don't know, but
>>> this name is stored as a string in another variable, like:
>>>
>>> x = 1
>>> var = 'x'
>>>
>>> Now I want to change the value of
Sorry if my Subject line isn't clear about what my question is.
I have a script that uses the turtle and random modules to create SVG
files, one after another, in a directory just for the SVGs. The
script assigns filenames in the form, "n.svg", where n is an integer.
E.g. 1.svg, 2.svg. 3.svg, .
22 matches
Mail list logo