On 30-Apr-09, at 12:12 AM, Dave Crouse wrote:
Trying to print something with a { in it.
Probably extremely simple, but it's frustrating me. :(
print ('The \"This is a test \" {')
i get this error
ValueError: Single '{' encountered in format string
Worked perfectly for me.
===
$ python3.0
On 25-Apr-09, at 11:41 PM, Dan Liang wrote:
Hi Bob and tutors,
Thanks Bob for your response! currently I have the current code, but
it does not work:
ListLines= []
for line in open('test.txt'):
line = line.rstrip()
ListLines.append(line)
for i in range(len(ListLines)):
if Lis
On 12-Feb-09, at 1:31 AM, Andres Sanchez wrote:
Fellows,
I am trying to extract information from a spreadsheet to use it in
Python. For instance, say I have the number 5.6 in cell A1 of Sheet1
in the file example.xls . Could anyone of you ladies and gentleman
let me know what commands I n
Straight forward method would be...
>>> a=[[1],[2]]
>>> b={}
>>> for x in range(len(a)):
... b[x] = a[x]
...
>>> a
[[1], [2]]
>>> b
{0: [1], 1: [2]}
>>>
regards,
shantanoo
On 21-Sep-08, at 11:36 AM, Dinesh B Vadhia wrote:
Hi! Say, I've got a numpy array/matrix of the form:
[[1 6 1 2 3]
Solution 1:
>>> a=[2,3,1,4]
>>> b=a[:]
>>> a
[2, 3, 1, 4]
>>> b
[2, 3, 1, 4]
>>> a.sort()
>>> a
[1, 2, 3, 4]
>>> b
[2, 3, 1, 4]
>>>
Solution 2:
>>> from copy import deepcopy
>>> a=[2,1,3,4]
>>> b=deepcopy(a)
>>> a
[2, 1, 3, 4]
>>> b
[2, 1, 3, 4]
>>> a.sort()
>>> a
[1, 2, 3, 4]
>>> b
[2, 1, 3, 4]
On 24-Nov-07, at 10:57 AM, Lawrence Shafer wrote:
> How would I compare these two dates and extract the difference in
> H:M:S??
>
> 22 Nov 2007 18:54:07
> 23 Nov 2007 23:24:23
You can try, 'datetime' module.
'http://pleac.sourceforge.net/pleac_python/datesandtimes.html' may be
useful.
regar
On 27-Aug-07, at 2:20 PM, Michael wrote:
> Hi
>
> I am fairly new to Python and I wish to validate input. Such as
> wanting
> to check and make sure that an integer is entered and the program not
> crashing when a naughty user enters a character instead. I have been
> trying to use the Type() f
+++ Dick Moores [30-09-06 10:47 -0700]:
| At 05:07 AM 9/30/2006, Liam Clarke wrote:
| >Dick Moores wrote:
| > > At 03:22 AM 9/30/2006, Liam Clarke wrote:
| > >> Dick Moores wrote:
|
| > >> A Python list sort is destructive, as you can see - it has modified
| > >> lst. So, to emphasise that it is d
+++ William Allison [29-09-06 18:55 -0400]:
| Hi,
| Just learning Python, on chapter 6 of Learning Python 2nd Ed. So, on to
| the question. Is there a better way to
| implement the code below? It scans a saved html file and highlights
| certain keywords is a bold, red font. It works,
| but I
+++ Shantanoo Mahajan [28-09-06 21:12 +0530]:
| +++ Dave S [28-09-06 16:10 +0100]:
| | I currently running XP (like a fish out of water :) and I need to know the
dir
| | that the python script is executed from. a linux 'pwd' How can I achieve
| | this - I have looked in sys & os
+++ Dave S [28-09-06 16:10 +0100]:
| I currently running XP (like a fish out of water :) and I need to know the
dir
| that the python script is executed from. a linux 'pwd' How can I achieve
| this - I have looked in sys & os & os.path but found nothing suitable
Python 2.4.
+++ Christopher Spears [10-07-06 21:34 -0700]:
| I'm working on a problem from "How To Think Like A
| Computer Scientist". I created a Time class:
|
| class Time:
|
| def __init__(self, hours, minutes, seconds):
| self.hours = hours
| self.minutes = minut
+++ Emily Fortuna [22-06-06 13:22 -0400]:
| I feel like there should be a better way to do this process:
| Can you please help?
| (This is trivial example code I created off the top of my head, but the
| same concept that I am trying to do elsewhere.)
|
| class Person(object):
| def __init_
+++ Hugo Gonz?lez Monteverde [08-11-05 13:13 -0600]:
| Hi Mike,
|
| Converting an (almost)arbitrary object into a string is what the Pickle
module does. CPickle is faster. Take
| a look into into it in the docs.
|
Is there a way to dump the varialble in XML format and retrive it?
e.g.
a="this
+++ Bernard Lebel [03-11-05 14:16 -0500]:
| I use plink
| http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
|
| Basically you send a system command (os.system) to the plink
| executable. The actuall command will take this form:
|
| os.system( 'plink -pw %s -ssh [EMAIL PROTECTED] %s'
+++ Srinivas Iyyer [02-08-05 14:54 -0700]:
| Hello group:
|
| I have a file (3339203 lines) that looks like this:
|
| (col:1)(col:2) (col:3)
| AD134KL
| X X
| X X
| X X
|
| AD144KL
| Y YYY
+++ Jorge Louis De Castro [20-07-05 23:20 +0100]:
| Hello,
|
| Is there a way of creating a Windows .exe from a .py file that does not
involve unzipping several files onto a folder?
| Does someone know of a program that wraps all the files needed into one
single (non-installable) executable?
|
+++ Johan Geldenhuys [14-12-04 15:18 +0200]:
| Hi,
| I want to find out how to open a .cvs file on a remote Windows machine
| and get file to my local linux folder.
.cvs file??
|
| Any help would be appreciated.
| --
|Johan
|
| --
| This E-Mail has been scanned.
| Enjoy Your Day.
|
18 matches
Mail list logo