snip.
247codegirl.bsky.social @247codegirl.bsky.social
Jul 4, 06:05 AM

Season 1 Lesson 29 Part 5 - Your First Steps in Python Understand Tab And New Line #pythonprogramming #softwaredeveloper #learncoding #softwarengineer #datascience #python #codingtutorial #vibecoding #gcp #machinelearning #dataengineer #pythoncode #azure #jupyternotebook #aws #dataanalysis

๐ŸŽค Whisper Transcript (en) โฑ 178s

"As we dive deeper into Python regular expressions, it's essential to master two critical characters, the tab and the new line. Let's start with the new line character. Take a look at this string right here. Hello, new world. Got it? When we print this, watch what happens. The output reads hello, space, new, and then world on a fresh line. Notice how world is shifted down. That's because our code utilizes triple quotation marks. This unlocks multi-line inputs in Python. Hit Enter in the editor, and a new line instantly appears in your output. Behind the scenes, Python stores actual new line characters. But where exactly are these hidden characters? If we inspect the raw formatting right here, you'll spot a clear new line character immediately following the word new, right there, and another one right after, creating that empty line. Let's move new onto its own line to make this crystal clear. Let's clean up this extra space. Now we have hello, followed by a new line character written as backslash n. Then comes the word new, instantly followed by another new line, and finally, the word world. Hello, new world. Here is the trick. You don't even need triple quotes to do this. You can embed these new line characters directly into a standard single line string. If we run a basic single line string without them, everything prints on one line. But to split it up, simply insert the backslash n escape and look at that. Hello, new world. Break perfectly across separate lines. The raw representation matches exactly what we typed, proving we don't need triple quotes. Now, how do we manipulate this with regular expressions? If we have a string containing new lines, we can easily replace them using the subfunction from the re module. No external installations needed. It's built right into Python. We will target the new line character and swap it out for an empty string. Run this, and boom, hello world is unified on a single line. Without that powerful regex replacement, it defaults back to multi-line layout. But regex gives you full control. The exact same magic applies to tabs. Let's swap out that new line character for a tab. Check out this shift in the output. There is a wide gap between hello and new. That is a tab character. It behaves completely differently from a standard space. If we manual input spaces like this, adding one, two, three spaces, they register as three distinct highlightable slots. But look closely at backslash T right here. That entire block is a single unified character. In our raw output, it is explicitly shown as backslash T while new lines show up as backslash N. This is the foundation of mastering backslash T and backslash N. Remember, T stands for tab and N stands for new line. Let's see how regular expressions can effortlessly replace them. We can target them precisely. Watch how we swap a tab. If our string contains a backslash."

โค๏ธ 0 ๐Ÿ” 0 ๐Ÿ’ฌ Discussion
Bluesky โ†—

๐Ÿ’ฌ Discussion

247codegirl.bsky.social @247codegirl.bsky.social ยท Jul 3, 05:05 PM

Season 1 Lesson 29 Part 5 - Your First Steps in Python Understand Tab And New Line #pythonprogramming #softwaredeveloper #learncoding #softwarengineer #datascience #python #codingtutorial #vibecoding #gcp #machinelearning #dataengineer #pythoncode #azure #jupyternotebook #aws #dataanalysis

๐Ÿ”Š More Like This

โ–ถ
๋•€ ๋ฐด ๋ชจ์ž, ๋ฌผ์— ๋‹ด๊ทธ์ง€๋„ ๋ชปํ•˜๊ณ  ๊ทธ๋ƒฅ ์“ฐ๊ณ  ๊ณ„์„ธ์š”? ๐Ÿงข ์„ธํƒ๊ธฐ์— ๋„ฃ์ž๋‹ˆ ํ˜•ํƒœ๊ฐ€ ๋ง๊ฐ€์งˆ ๊ฒƒ ๊ฐ™๊ณ , ์†๋นจ๋ž˜ํ•ด๋„ ์†๊นŒ์ง€ ์ œ๋Œ€๋กœ ๊ฑด์กฐ๋˜๋Š”์ง€ ๋ถˆ์•ˆํ•˜๊ณ โ€ฆ ๋ชจ์ž ์œ„์ƒ ๊ด€๋ฆฌ, ์ƒ๊ฐ๋ณด๋‹ค ์‰ฝ์ง€ ์•Š์ฃ . UV ์‚ด๊ท  ๊ฑด์กฐ๊ธฐ๋ฅผ ์“ฐ๋ฉด ์ž์™ธ์„ ์œผ๋กœ ์„ธ๊ท ๊ณผ ๋ƒ„์ƒˆ ์›์ธ๊ท ์„ ์ผ€์–ดํ•˜๋ฉด์„œ ๋‚ด๋ถ€๊นŒ์ง€ ๊ฑด์กฐํ•ด์ค˜์„œ ๋•€ ๋ƒ„์ƒˆ ๊ฑฑ์ •์„ ๋œ ์ˆ˜ ์žˆ์–ด์š”. ๐ŸŒž ๋ฌผ ํ•œ ๋ฐฉ์šธ ์•ˆ ์“ฐ๊ณ  ์œ„์ƒ ์ผ€์–ด๊ฐ€ ๋œ๋‹ค๋Š” ๊ฒŒ ํ•ต์‹ฌ์ด์—์š”. ์šด๋™ ๋ชจ์ž, ์•ผ๊ตฌ ๋ชจ์ž, ๋ฒ„ํ‚ทํ–‡์ฒ˜๋Ÿผ ๋ฌผ ๋นจ๋ž˜๊ฐ€ ์–ด๋ ค์šด ์†Œ์žฌ๋„ ํ˜•ํƒœ ๋ณ€ํ˜• ์—†์ด ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ์–ด์„œ ๋งค์ผ ์“ฐ๋Š” ๋ชจ์ž๋ฅผ ๋Š˜ ์พŒ์ ํ•˜๊ฒŒ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ์ฃ . โœจ ๊ตฌ๋งคยท์ •๋ณด @1m-item.bsky.social