[Tutor] Why doesn't getopt() handle this character '^' ?

Bob Gailer ramrom@earthling.net
Mon Mar 3 11:11:11 2003


--=======64865D1F=======
Content-Type: multipart/alternative; x-avg-checked=avg-ok-408946F3; boundary="=====================_8822365==.ALT"


--=====================_8822365==.ALT
Content-Type: text/plain; x-avg-checked=avg-ok-408946F3; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit

At 11:18 PM 3/2/2003 -0800, you wrote:
>When I pass these arguments to my module
>2 ^ 2  as in (python mymodule.py 2 ^ 2)
>This is what is displayed
>Args=
>['2', '2']
>This is the code in my module
>import sys, operator
>opts, args = getopt( sys.argv[1:], "")
>print"\nArgs= "
>print args
>
>getopts() works for other operators
>as in 2 * 2
>
>Args=
>['2', '*', '2']

What op sys? I'm running Win2K; when I try python mymodule.py 2 ^ 2 the ^ 
doesn't even appear in sys.argv. So, for me, it is not a getopt issue, it 
is an issue of passing data to sys.argv from the command line.

Bob Gailer
mailto:ramrom@earthling.net
303 442 2625


--=====================_8822365==.ALT
Content-Type: text/html; x-avg-checked=avg-ok-408946F3; charset=us-ascii
Content-Transfer-Encoding: 8bit

<html>
<body>
At 11:18 PM 3/2/2003 -0800, you wrote:<br>
<blockquote type=cite class=cite cite>When I pass these arguments to my
module<br>
2 ^ 2&nbsp; as in (python mymodule.py 2 ^ 2)<br>
This is what is displayed<br>
Args=<br>
['2', '2']<br>
This is the code in my module<br>
<font face="Courier New, Courier">import sys, operator<br>
opts, args = getopt( sys.argv[1:], &quot;&quot;)<br>
print&quot;\nArgs= &quot;<br>
print args<br><br>
getopts() works for other operators<br>
as in 2 * 2<br><br>
Args=<br>
['2', '*', '2']</font></blockquote><br>
What op sys? I'm running Win2K; when I try python mymodule.py 2 ^ 2 the ^
doesn't even appear in sys.argv. So, for me, it is not a getopt issue, it
is an issue of passing data to sys.argv from the command line.<br>
<x-sigsep><p></x-sigsep>
Bob Gailer<br>
<a href="mailto:ramrom@earthling.net" eudora="autourl">mailto:ramrom@earthling.net</a><br>
303 442 2625<br>
</body>
</html>


--=====================_8822365==.ALT--

--=======64865D1F=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-408946F3
Content-Disposition: inline


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 2/25/2003

--=======64865D1F=======--