Python basic program problem

2011-06-27 Thread Amaninder Singh
Hi,
I am fairly new to python, I am trying to write simple code and It is
giving me syntax error. I am reading a book and following the
directions as it says in the book but I am not sure why it is not
working. Please guide me through. Any help appreciated.
>>> x = 2
>>> if x == 2:
   print "This is a test"

SyntaxError: invalid syntax
>>> if x == 2:
   print "This is a test"

SyntaxError: invalid syntax
>>> x = 2
>>> if x = 2:

SyntaxError: invalid syntax
>>> if x == 2:
print "This is test"

SyntaxError: invalid syntax
>>> Type "copyright", "credits" or "license()" for more information.
SyntaxError: invalid syntax
>>>
>>>
>>> print "this is a test"
SyntaxError: invalid syntax
>>> import keyword
>>> print keyword.kwlist
SyntaxError: invalid syntax
>>> print "hellow world"
SyntaxError: invalid syntax
>>> print 'hellow world'
SyntaxError: invalid syntax
>>>
-- 
http://mail.python.org/mailman/listinfo/python-list


Change the name with the random names in a text file

2011-06-28 Thread Amaninder Singh
Hi Guys,
I am fairly new to the language and programing. I am trying to solve a
problem in a text file. Where names are something like in this  manner
[**Name2 (NI) 98**]

[**Last Name (STitle) 97**]
 [**First Name4 (NamePattern1) 93**]
[**Last Name (NamePattern1) 94**]
([**Name (NI) 95**])
 [**Last Name (un) 96**]
I am trying to change these with random names.
Any ideas or how should I do it.
Any help appreciated.
Thank in advance
-- 
http://mail.python.org/mailman/listinfo/python-list