How can I convert a std::string to int?

In C++11 there are some nice new convert functions from std::string to a number type. So instead of you can use where str is your number as std::string. There are version for all flavours of numbers: long stol(string), float stof(string), double stod(string),… see http://en.cppreference.com/w/cpp/string/basic_string/stol

strip(char) on a string

You need to replace() in this use case, not strip() strip(): string.strip(s[, chars]) Return a copy of the string with leading and trailing characters removed. If chars is omitted or None, whitespace characters are removed. If given and not None, chars must be a string; the characters in the string will be stripped from the … Read more

Changing one character in a string

Don’t modify strings. Work with them as lists; turn them into strings only when needed. Python strings are immutable (i.e. they can’t be modified). There are a lot of reasons for this. Use lists until you have no choice, only then turn them into strings.

Replacing instances of a character in a string

Strings in python are immutable, so you cannot treat them as a list and assign to indices. Use .replace() instead: If you need to replace only certain semicolons, you’ll need to be more specific. You could use slicing to isolate the section of the string to replace in: That’ll replace all semi-colons in the first 10 characters of the … Read more