🌐
GeeksforGeeks
geeksforgeeks.org › python › python-string
Python String - GeeksforGeeks
A new string is created by combining "A" with s[1:] (rest of the string). Individual characters of a string cannot be deleted because strings are immutable. However, an entire string variable can be removed using del keyword.
Published: 2 weeks ago
🌐
W3Schools
w3schools.com › python › python_strings.asp
Python Strings
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... Strings in python are surrounded by either single quotation marks, or double quotation marks. ... print("It's alright") print("He is called 'Johnny'") print('He is called "Johnny"') Try it Yourself » · Assigning a string to a variable is done with the variable name followed by an equal sign and the string:
Discussions

Meaning of empty string "" in this example
From the documentation : The separator between elements is the string providing this method. Maybe not so clear, but it means the iterable in str.join(iterable) will be joined with str as separtor. Some examples: >>> l = ['a', 'b', 'c'] >>> ''.join(l) 'abc' >>> ','.join(l) 'a,b,c' >>> '__'.join(l) 'a__b__c' >>> '! !'.join(l) 'a! !b! !c' More on reddit.com
🌐 r/learnpython
5
1
November 6, 2022
Are there any python package that can intelligently parse strings containing numbers?
🌐 r/Python
24
18
January 1, 2015
PRAW user_agent (I'm a noob)
A user agent header is a string of text that is sent with HTTP requests to identify the program making the request (the program is called a "user agent"). Web browsers commonly send these in order to identify themselves (so the server can tell if you're using Chrome or Firefox, for example). Many APIs will want you to use a unique user agent string for your program. This is so that if your program misbehaves for some reason, they can more easily identify it, rather than have it look like a browser or just a generic default (this is why they tell you not to spoof a browser). The user agent is something that a human might read at some point in a log somewhere, so it's useful to include something like the name of your program and, in case of Reddit, your username in it. That way, if your program is doing something wrong, the admin reading the server logs can figure out how to talk to you. More on reddit.com
🌐 r/Python
3
2
June 10, 2013
Information and code examples on how to use the zstandard Python module to compress / decompress data

Here's a quick example of how to stream the decompression, since python can't load in an entire ~13 gig file at once into memory.

with open("filename.zst", 'rb') as fh:
    dctx = zstd.ZstdDecompressor(max_window_size=2147483648)
    with dctx.stream_reader(fh) as reader:
        previous_line = ""
        while True:
            chunk = reader.read(2**24)  # 16mb chunks
            if not chunk:
                break

            string_data = chunk.decode('utf-8')
            lines = string_data.split("\n")
            for i, line in enumerate(lines[:-1]):
                if i == 0:
                    line = previous_line + line
                object = json.loads(line)
                # do something with the object here
            previous_line = lines[-1]

Edit: Updated per rhaksw's suggestion below

More on reddit.com
🌐 r/pushshift
6
9
January 26, 2019
People also ask

How do you concatenate strings in Python?
Use the + operator: "hello" + " world" or use f-strings: f"{a} {b}"
🌐
pythonbasics.org
pythonbasics.org › home › python basics › python strings (with examples)
Python Strings (With Examples) - pythonbasics.org
🌐
Mimo
mimo.org › glossary › python › string
Python Strings: Essential Tips & Tricks | Learn Python Today
Start your coding journey with Python. Learn basics, data types, control flow, and more ... The value of single-quote and double-quote strings is the same. In the example, both calls of the print() function display Hello, World!.
🌐
Programiz
programiz.com › python-programming › string
Python Strings (With Code Visualization)
In this program, we are concatenating strings 'Opus', ' ' and '5' using + operator to create a new string. Note that we are not modifying strings 'Opus', ' ' and '5'; that's not possible. Python provides many string methods out of the box that make it easy to manipulate strings. For example, replace() method, text = "ChatGPT is great." # Replace "ChatGPT" with "Claude" new_text = text.replace("ChatGPT", "Claude") print(new_text) # Output: Claude is great.
🌐
Python Basics
pythonbasics.org › home › python basics › python strings (with examples)
Python Strings (With Examples) - pythonbasics.org
% 7 print(s) # alternative method of combining numbers and text s = "My lucky number is " + str(7) + ", what is yours?" print(s) # print character by index print(x[0]) # print piece of string print(x[0:3]) ... Make a program that displays your favourite actor/actress. Try to print the word 'lucky' inside s. Try to print the day, month, year in the form "Today is 2/2/2016". ... Complete the function that returns the sum of all even numbers in a list. def sum_even(numbers): total = 0 for n in numbers: if n ___ 2 == 0: total ___ return total · Use % to check if a number is even. Add to total with +=
🌐
Python
docs.python.org › 3 › library › string.html
string — Common string operations
If it is an integer, it represents the index of the positional argument in args; if it is a string, then it represents a named argument in kwargs. The args parameter is set to the list of positional arguments to vformat(), and the kwargs parameter is set to the dictionary of keyword arguments. For compound field names, these functions are only called for the first component of the field name; subsequent components are handled through normal attribute and indexing operations. So for example, the field expression ‘0.name’ would cause get_value() to be called with a key argument of 0.
🌐
InterServer
interserver.net › home › python › python strings made easy: learn basics with simple examples
Python Strings Made Easy: Learn Basics with Simple Examples - Interserver Tips
April 23, 2026 - If you try to access the wrong position, Python will show an error or give the wrong result. Misusing Quotes: Another mistake is mixing single and double quotes in the wrong way. For example, starting a string with a single quote and ending it with a double quote will cause an error.
Find elsewhere
🌐
Dataquest
dataquest.io › home › blog › python strings: an in-depth tutorial (55+ code examples)
Python Strings: An In-Depth Tutorial (55+ Code Examples)
April 24, 2025 - Indexing and Slicing: we already established that strings are zero-indexed. We can access any element in a string with its index value. We can also take subsets of a string by slicing between two index values. For example: main_string = "I learned R and Python on Dataquest.
🌐
Stanford CS
cs.stanford.edu › people › nick › py › python-string.html
Python Strings
A format string is a relatively new way to convert a python value into a string. The format string begins with a literal 'f' before the first quote mark, for example f'format string of {n}'
🌐
Tutorialspoint
tutorialspoint.com › python › python_strings.htm
Python - Strings
To embed a single quoted text, string should be written in double quotes. var = 'Welcome to "Python Tutorial" from TutorialsPoint' print ("var:", var) var = "Welcome to 'Python Tutorial' from TutorialsPoint" print ("var:", var) ... var: Welcome to "Python Tutorial" from TutorialsPoint var: Welcome to 'Python Tutorial' from TutorialsPoint · To form a string with triple quotes, you may use triple single quotes, or triple double quotes − both versions are similar.
🌐
WsCube Tech
wscubetech.com › resources › python › strings
String Methods in Python: All List With Examples
August 6, 2026 - Learn Python strings with simple examples in this step-by-step tutorial. Understand Python string operations, string methods, and how strings work in Python.
🌐
Python Tutorial
pythontutorial.net › home › python basics › python string
Python String
March 30, 2025 - Slicing allows you to get a substring from a string. For example: str = "Python String" print(str[0:2])Code language: Python (python) ... The str[0:2] returns a substring that includes the character from the index 0 (included) to 2 (excluded).
🌐
Google
developers.google.com › google for education › python › python strings
Python Strings | Python Education | Google for Developers
Since strings can't be changed, we construct *new* strings as we go to represent computed values. So for example the expression ('hello' + 'there') takes in the 2 strings 'hello' and 'there' and builds a new string 'hellothere'.
🌐
Pythonread
pythonread.github.io › strings.html
Python Strings (With Examples) - Python Tutorial
If you create string variable x. You can show it on the screen using the print() function. Individual characters can be accessed using blockquotes, counting starts from zero. The first character starts at zero. This may be a bit counter intuitive, but has historic reasons. By using a colon you can create a substring. If no start or end number is written, Python assumes you mean the first character or last character. ... This example does a lot of string operations like printing text, numbers, combining strings, slicing and accessing elements.
🌐
Internshala
trainings.internshala.com › home › programming › python › python string functions with examples
Python String Functions With Examples
May 16, 2023 - For example, string = “Internshala is Working to Equip Students with Relevant Skills and Practical Exposure” print(string.upper()) Output: INTERNSHALA IS WORKING TO EQUIP STUDENTS WITH RELEVANT SKILLS AND PRACTICAL EXPOSURE · The capitalize() string function returns a given string into a new string where only the first character is in the uppercase and all the remaining characters are in the lowercase. Syntax: “string.capitalize()” is the syntax of capitalize string function. For example, string = “i am learning the PYTHON Programming Language” print(string.capitalize()) Output: I am learning python programming language.
🌐
CodeChef
codechef.com › blogs › strings-in-python
Python String (Examples and Practice)
July 12, 2024 - In Python, we use the + operator to concatenate strings. x = "Good" y = "Work" print(x + y) # Output: GoodWork · To add a space between words, we can include a space in one of the strings or add a space string: ... Create two variables x and y. Assign "Hello" to x and "World" to y. Print them together with a space in between.
🌐
IncludeHelp
includehelp.com › python › string-programs.aspx
Top 50+ Python String Programs (Examples) with Solutions
A string is a sequence of characters enclosed by either single quotes or double quotes in Python. This section contains solved Python string programs. Practice these Python string programs to create, format, modify, delete strings, etc., with various string operations and functions. Every program has solved code, output, explanation of the statement/functions. The below is the set of top 50+ Python string programs (examples):
🌐
Tutorial Teacher
tutorialsteacher.com › python › python-string
Python Strings
str1='Welcome to "Python Tutorial" on TutorialsTeacher' print(str1) str2="Welcome to 'Python Tutorial' on TutorialsTeacher" print(str2) Try it · Use the len() function to retrieve the length of a string, as shown below. Example: Get String Length Copy · greet='Hello' n = len(greet) #returns 5 · Try it · A sequence is defined as an ordered collection of items. Hence, a string is an ordered collection of characters. The sequence uses an index, starting with zero to fetch a certain item (a character in case of a string) from it.
🌐
Codecademy
codecademy.com › docs › python › strings
Python | Strings | Codecademy
August 11, 2025 - For example, + can be used to concatenate strings and * can be used to multiply a string. The keyword in can be used to see if a given character or substring exists in a string: ... The f/F flag (placed before the opening quotation mark). The .format() method (requires manually adding placeholders). Python can use comparison operators to compare the contents of two strings. The operators behave as they do with numeric arguments:
🌐
DataCamp
datacamp.com › tutorial › python-string-tutorial
Python String Tutorial | DataCamp
January 18, 2018 - In unicode, each letter, character is represented as a 4-byte number. Each number represents a unique character. To represent a string, you wrap it within quotes. There can be multiple ways of doing this: Single quotes, just like in this example: 'Single quote allow you to embed "double" quotes ...