This time we will study string variables You need to understand the character code. There is Unicode. There is ASCII code. ASCII code first. ASCII code is alphabetical 8bit is 1 byte. 256 characters only. It’s an expression The alphabet is actually 256 characters. Korean Chinese Japanese You don’t have to support this multilanguage So came out Unicode. This is a multinational based on 16 bit 2 bytes. Writing system Will be the code that accepts the most characters in the world. In Python, single or double quotes are used to represent strings. I tie it up and express it. And when expressing multiple lines, within three single quotes like this I’ll write it. I put in a string and printed it out. you can see that it is in the form of str string Sometimes you have to break a line Newline Is to change rows If you want to break the line like this back slash + n Write three quotes You have to write several lines, then 3 single quotes or 3 double quotes Originally plus is a number calculation But here It means to concatenate two strings. Only strings and strings can be plus Strings and numbers cannot be plus We need to convert the numbers into strings If a number is in the str () function The number is replaced with a string This is used when you want to repeat a string several times. This string is repeated 50 times Next we will look at string indexing. The first letter is from 0. 0 1 2 3 4 String is a set of characters Using square brackets Write down the numeric index Say the first letter from the right Basically it starts from the left minus adds up from the right It’s called a colon It’s called a semi colon. In Python, no semi colon is used. Single quote double quote Starting at 0 and continuing It means stop at 5. Then what happens? 0 1 2 3 4 From 0 to 4 If there is no start and end, it is full Many of these expressions come forward 0 before the colon, to the end after the colon is omitted When the colon is missing, it’s all The value stored in the age variable is output here. This is important. Percent refers to location s is in string format f is in real form String is% s Number is% d I see a list of types Have multiple values, so later This is what you need when you iterate Making a list of strings by dividing them by delimiters split () Now let’s look at a function that removes whitespace. There are times when you need to remove a space strip ()

Leave a Reply

Your email address will not be published. Required fields are marked *