On 11月27日, 下午5时35分, "84715...@qq.com" <84715...@qq.com> wrote: > On 11月27日, 下午5时28分, luca72 <lucabe...@libero.it> 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 <ben+pyt...@benfinney.id.au> wrote: > > > > luca72 <lucabe...@libero.it> 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- 隐藏被引用文字 - > > > - 显示引用的文字 - > > <p> <strong><a title="sport jersey" href="http://www.jerseysup.com" > target="sport jersey">sport jersey</a></strong> > <a title="sport jersey" > href="http://www.sport-jersey.net" target="sport > jersey"><strong>sports jersey </strong></a><strong> </strong><a > title="ugg women" href="http://www.uggwomen.net" target="ugg > women"><strong>uggboot </strong></a><strong> </strong><a title="nike > market " href="http://www.nike-market.com" target="nike > market"><strong>nike</strong></a></p>- 隐藏被引用文字 - > > - 显示引用的文字 -
http://www.enjoyebay.com/ -- http://mail.python.org/mailman/listinfo/python-list