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 |
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! |
All times are GMT -7. The time now is 05:21 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC