1. First open pycharm and enter the pycharm homepage.
2. Then create a new python script, right-click--click new--click python file.
3. Enter a string, code: s = "-".
4. Then you need to repeat the symbols in the string 20 times, code: s1 = s * 20.
5. Enter the print output code, code: print(s1).
6. Finally run the script and you will see our return value at the bottom: - Repeated 20 times.
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!