By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,402 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,402 IT Pros & Developers. It's quick & easy.

python -c strangeness

P: n/a
Hello All,

Can you explain why:
[09:06] - adp86: python -c 'import sys; print 1'
1
[09:10] - adp86: python -c 'for i in range(3): print i'
0
1
2
[09:10] - adp86: python -c 'import sys; for i in range(3): print i'
File "<string>", line 1
import sys; for i in range(3): print i
^
SyntaxError: invalid syntax
Thanks.
Miki
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Miki Tebeka <mi*********@zoran.com> writes:
[09:10] - adp86: python -c 'import sys; for i in range(3): print i'
File "<string>", line 1
import sys; for i in range(3): print i
^
SyntaxError: invalid syntax


Simple statements can be separated with a semicolon, but a compound
statement (e.g "for") must begin on a new line. See the language
reference manual for the full grammar of Python.

--
Brian Gough

Network Theory Ltd,
Publishing the Python Manuals --- http://www.network-theory.co.uk/
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.