Enumerating words and Adding integer, character and string
jgentil at sebistar.net
Sat Mar 6 06:20:01 CET 2004
On Fri, 2004-03-05 at 21:15, dont bother wrote:
> 1. How do I make a vector of words in a file.
> File has
> I want to have this file:
> 1 Alpha
> 2 Beta
> 3 Gamma
> I just dont want to write it/print it instead I want a
> mapping. A vector kind of thing whose first attribute
> is interger second is the 'word'
f = open("filename", "r")
for l in f:
> 2. How to I create a string for example by adding:
> s=1 + ":" + "dont"
> this does not work if I normally try to concatenate
> and write to a file.
s = string(1) + ":" + "dont"
Remember that even though variables have no type declaration, Python is
a strongly-typed language. Adding a string to an integer just doesn't
work, the integer.
Jon-Pierre Gentil : PGP Key ID 0xA21BC30E
AIM: Zenethian : Jabber: zenethian at jabber.org
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 204 bytes
Desc: This is a digitally signed message part
More information about the Python-list