Python Forum
How to convert "str" to "int"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to convert "str" to "int"
#11
In python 3 you don't need to call ord() if self.header[4] is already an integer. Use this value directly.
Reply
#12
(Oct-15-2019, 03:45 PM)Gribouillis Wrote: In python 3 you don't need to call ord() if self.header[4] is already an integer. Use this value directly.

Sure, but then it doesn't work with older python. There isn't a way to make it work with both versions?
Reply
#13
colt Wrote:There isn't a way to make it work with both versions?
Yes there is
import sys
if sys.version_info < (3,):
    spam = ord(spam)
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020