FIND YOUR NEXT FEW LINES

Results for “version”

Small, practical examples. Search by task or narrow things down below.

46 snippets foundClear filters
PythonFiles & paths

Read a text file

Open a UTF-8 text file and read its contents. A context manager closes the file automatically, even if reading fails.

file✓ Tested
PythonJSON & CSV

Read CSV rows as dictionaries

Read a CSV file using its header row as dictionary keys, so each column can be accessed by name.

csv✓ Tested
PythonCollections

Remove duplicates from a list

Remove repeated hashable values while preserving the order in which they first appeared.

list✓ Tested
PythonStrings & dates

Replace text in a string

Replace every occurrence of a substring and keep the result in a new string. The original string is unchanged.

string✓ Tested
HTMLText semantics

Represent removed and inserted text

HTML: Del and ins record a textual change while retaining both versions in the document.

HTML✓ Tested
PythonCollections

Sort dictionaries by a value

Sort a list of dictionaries by a numeric field, leaving the original list unchanged.

sort✓ Tested
PythonStrings & dates

Split a string into words

Split text on whitespace, automatically treating repeated spaces, tabs, and line breaks as a single separator.

string✓ Tested
PythonJSON & CSV

Write a JSON file

Save a dictionary as readable, indented JSON while preserving Unicode characters.

json✓ Tested
PythonFiles & paths

Write a text file

Save a string to a UTF-8 text file and close the file automatically when the write finishes.

file✓ Tested
PythonJSON & CSV

Write dictionaries to CSV

Write a list of dictionaries to a CSV file with a header row and a predictable column order.

csv✓ Tested