#1
|
|||
|
|||
Converting a character to a number
I am currently trying to figure out how to retrieve a character from a text file and turn it to a number.
I currently split up the sentence and store the word I am interested in into an array, for example a spot in the array may look like the following: ['Interval=4;'] What I want to do is access the 4 and save its numeric value to a variable. If this is stored in array[1] for example, is there a way to access the 10th character, (the 4) and then convert it to a number? Thank you, Jassel41 |
#2
|
|||
|
|||
string = 'Interval=4'
string.split('=')[1] will return 4 (as string) int(string.split('=')[1]) will return 4 (as int) string[9] will return 4 (as string) int(string[9]) will return 4 (as int) And so on. Good luck! |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Special character | adimov | Vizard | 1 | 06-15-2009 12:32 PM |
character pack and walkto ? | digitaldarklord | Vizard | 1 | 09-30-2008 04:42 PM |
Native WorldViz support for character animation | luakt | Vizard | 10 | 09-15-2008 11:39 PM |
Locking every bone of a character | Frank Verberne | Vizard | 2 | 03-17-2008 10:21 AM |
limits on number of objects | benelux | Vizard | 3 | 07-22-2004 01:26 PM |