Re: hex int and string
On 11月27日, 下午5时28分, luca72 wrote: > i'm using pyscard > > and for send a command he need a list like this: > > cmd = [0xdd,0xff, etc] > > the problem is that i get a text > like dd > and i need to trasform it in 0xdd for the list and if i use hex i have > a sting that is not what i need > > Luca > > On 27 Nov, 10:22, Ben Finney wrote: > > > > > luca72 writes: > > > str = 'D3' > > > Be careful when choosing names. Here you have clobbered the existing > > string type binding to the name ‘str’. > > > > and i need to trasform in 0xd3 type int and not type string how i can > > > do this? > > > You already have the answer; you used it in your example below. I can > > only assume you're wanting something additional; what is that? > > > > if i do hex(int(str,16) ) i obtain a string and this is not what i > > > need. > > > You either want it as an int, or you want it as a string. Which is it? > > > >>> foo = 'D3' > > >>> int(foo, 16) > > 211 > > >>> 0xD3 > > 211 > > >>> int(foo, 16) == 0xD3 > > True > > > -- > > \ “Human reason is snatching everything to itself, leaving | > > `\ nothing for faith.” —Saint Bernard, 1090–1153 | > > _o__) | > > Ben Finney- 隐藏被引用文字 - > > - 显示引用的文字 - http://www.jerseysup.com"; target="sport jersey">sport jersey http://www.sport-jersey.net"; target="sport jersey">sports jerseyhttp://www.uggwomen.net"; target="ugg women">uggboothttp://www.nike-market.com"; target="nike market">nike -- http://mail.python.org/mailman/listinfo/python-list
Re: how to format a python source file with tools?
On 11月27日, 下午3时45分, cmptrwhz wrote: > On Nov 27, 12:40 am, 李白,字一日 wrote: > > > or is it possible for large source files? > > are you trying to format the file with the proper indentations? http://www.jerseysup.com"; target="sport jersey">sport jersey http://www.sport-jersey.net"; target="sport jersey">sports jerseyhttp://www.uggwomen.net"; target="ugg women">uggboothttp://www.nike-market.com"; target="nike market">nike -- http://mail.python.org/mailman/listinfo/python-list
Re: hex int and string
On 11月27日, 下午4时54分, luca72 wrote: > hello i have a problem > > i have this > > str = 'D3' > and i need to trasform in 0xd3 type int and not type string how i can > do this? > if i do > hex(int(str,16) ) i obtain a string and this is not what i need. > > thanks Luca http://www.jerseysup.com"; target="sport jersey">sport jersey http://www.sport-jersey.net"; target="sport jersey">sports jerseyhttp://www.uggwomen.net"; target="ugg women">uggboothttp://www.nike-market.com"; target="nike market">nike -- http://mail.python.org/mailman/listinfo/python-list
Re: hex int and string
On 11月27日, 下午6时59分, Marco Mariani wrote: > Ben Finney wrote: > >> i'm using pyscard > > > I don't know what that is; can you give a link to what you're referring > > to? > > Simple story: he has seen the examples with hex literals and didn't know > what they were. http://www.jerseysup.com"; target="sport jersey">sport jersey http://www.sport-jersey.net"; target="sport jersey">sports jerseyhttp://www.uggwomen.net"; target="ugg women">uggboothttp://www.nike-market.com"; target="nike market">nike -- http://mail.python.org/mailman/listinfo/python-list
Re: how to format a python source file with tools?
On 11月27日, 下午2时40分, 李白,字一日 wrote: > or is it possible for large source files? http://www.jerseysup.com"; target="sport jersey">sport jersey http://www.sport-jersey.net"; target="sport jersey">sports jerseyhttp://www.uggwomen.net"; target="ugg women">uggboothttp://www.nike-market.com"; target="nike market">nike -- http://mail.python.org/mailman/listinfo/python-list