Is it, in Python, possible to address a specific character in a string by the standard array syntax?
Example, PHP:
$foo = 'bar';
echo $foo[1]; // Output: a
It didn’t work like in PHP so I wanted to know if it is possible using some other way?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As Adam pointed out, reading from a string array is possible in Python using the indexing syntax. What isn’t possible though is writing to a string using this syntax:
Maybe this was the problem you ran into?