Skip to content

Commit

Permalink
review suggestions
Browse files Browse the repository at this point in the history
* group code sections with `# %%` (will be separate cells in notebooks)
* more meaningful comments

Co-authored-by: Christian Tischer <[email protected]>
  • Loading branch information
k-dominik and tischi committed May 28, 2024
1 parent d0ad0a2 commit 82e50b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion _includes/string_concat/creating_log_messages.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# creating log messages
# %%
# Creating log messages

image_index = 11
num_images = 100

# %%
# strings can be added together with the '+' operator
print("Analyzing image " + str(image_index) + "/" + str(num_images) + "...")

# %%
# An alternative way to combine strings and variables from your code
# are so called f-strings: in f-strings you can add variables (and some
# code) in between curly braces. Types are automatically coerced to strings.
Expand Down
7 changes: 6 additions & 1 deletion _includes/string_concat/manipulating_file_paths.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# manipulating file paths
# %%
# Manipulating file paths

import pathlib
import tempfile

# %%
# Let's get a folder and a file name to practice with.
# Temporary folder is different on different operating systems.
# We use tempfile.gettempdir() from the standard library as it has all that logic.
tmp_folder = pathlib.Path(tempfile.gettempdir())
file_name = "nuclei.tif"

# %%
# Combine folder and file name.
# pathlib.Path objects support "syntactic sugar", like using '/' as a
# separator when composing paths.
path = tmp_folder / file_name
Expand Down

0 comments on commit 82e50b8

Please sign in to comment.