Home >Backend Development >Python Tutorial >How to repeat a string in python_python repeating string tutorial

How to repeat a string in python_python repeating string tutorial

PHPz
PHPzforward
2024-04-02 15:58:20986browse

1. First open pycharm and enter the pycharm homepage.

How to repeat a string in python_python repeating string tutorial

2. Then create a new python script, right-click--click new--click python file.

How to repeat a string in python_python repeating string tutorial

3. Enter a string, code: s = "-".

How to repeat a string in python_python repeating string tutorial

4. Then you need to repeat the symbols in the string 20 times, code: s1 = s * 20.

How to repeat a string in python_python repeating string tutorial

5. Enter the print output code, code: print(s1).

How to repeat a string in python_python repeating string tutorial

6. Finally run the script and you will see our return value at the bottom: - Repeated 20 times.

How to repeat a string in python_python repeating string tutorial

The above is the detailed content of How to repeat a string in python_python repeating string tutorial. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:zol.com.cn. If there is any infringement, please contact admin@php.cn delete