Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--xl/--extract-last #718

Merged
merged 6 commits into from
Jan 24, 2025
Merged

--xl/--extract-last #718

merged 6 commits into from
Jan 24, 2025

Conversation

simonw
Copy link
Owner

@simonw simonw commented Jan 24, 2025

@simonw
Copy link
Owner Author

simonw commented Jan 24, 2025

Found a weird bug with this input:

Here are five ways to print a string in Python:

Using the `print()` function is the most straightforward way. Just pass the string as an argument:

```python
print("Hello, World!")
```

You can also use formatted strings (f-strings), which allow you to embed expressions inside string literals:

```python
name = "Alice"
print(f"Hello, {name}!")
```

Another option is using the `format()` method, which inserts variables into a string placeholder:

```python
greeting = "world"
print("Hello, {}!".format(greeting))
```

You can also leverage the old-style string formatting with the `%` operator:

```python
age = 30
print("I am %d years old." % age)
```

Lastly, the `sys` module can be used to print strings to standard output with `sys.stdout.write()`, which does not automatically add a newline:

```python
import sys
sys.stdout.write("Hello, World!\n")
``` 

These methods give you various ways to display strings in Python, depending on your needs.

The last=True one was not getting that last block.

It turns out there's an invisible single space character after the closing triple backticks there!

@simonw simonw linked an issue Jan 24, 2025 that may be closed by this pull request
@simonw simonw merged commit 656d8fa into main Jan 24, 2025
62 checks passed
@simonw simonw deleted the extract-last branch January 24, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--xl/--extract-last option
1 participant