Platform-independent directory delimiters - Deepstash
Machine Learning With Google

Learn more about computerscience with this collection

Understanding machine learning models

Improving data analysis and decision-making

How Google uses logic in machine learning

Machine Learning With Google

Discover 95 similar ideas in

It takes just

14 mins to read

Platform-independent directory delimiters

Making your Python code as re-usable as possible should be one of your main concerns. But what if you’re working on a Unix platform and your colleague is working on Windows?

The path delimiter on Windows is \ , but on my Linux or Mac system, it is / . Avoid dealing with these nuances by using the built-in os library:

2

29 reads

MORE IDEAS ON THIS

.get instead of [key] for dictionary iterations

Dictionaries are great data-types for storing values with an attribute field known as the key , in so-called key-value pairs . When extracting key-value pairs from dictionaries, avoid running into KeyError exceptions with the .get m...

2

17 reads

Loop two iterators with the zip function

I love the zip function and it has saved me countless (nested) loops. I use it mostly for iterating over two data types at the same time, where I need the indexes to be equal.

You can do this with any data type or generator. For instance, you could create dictionaries without l...

2

18 reads

Multiple assignment with * and **

the * prefix operator was added to the multiple assignment syntax, allowing us to unpack the remaining items in an iterable.

The ** operator does something similar, but with keyword arguments. The ** operator allows us to take a dictionary of key-value...

3

17 reads

List comprehensions

List, tuple, and dictionary comprehensions are ways to code more efficiently: do the same in fewer lines of code.

Both lines 2-4 and lines 13-15 are compressed in single-line expressions in line 6 and line 17 . This saves up unnecessary lo...

2

14 reads

String formatting with f-strings

Hallelujah! That is what I thought when I learned about the Python 3.6+ update that includes a new way of formatting strings: the Python formatted string literal. String formatting in Python has come a long way.

F-strings consider everything within { curly brackets } as an ...

3

54 reads

Variable unpacking

Unpacking variables are probably most used for functions that return multiple variables, such as in the example below.

But it is also useful for data types that contain multiple items. The only important notion here is that, if not otherwise defined, variable unpacking results in tupl...

2

21 reads

CURATED FROM

CURATED BY

Related collections

More like this

7 Things You Need To Understand About Anxiety And Depression

No, we are not over yet. After discussing the topic with my friend’s Dad (he is a doctor), I’ve made a list of things you need to understand and avoid anxiety attacks (hard to breathe moments).

  1. Think of your anxiety as a biological problem, rather than thinking there is something wron...

stash-superman-illustration

Explore the World’s

Best Ideas

200,000+ ideas on pretty much any topic. Created by the smartest people around & well-organized so you can explore at will.

An Idea for Everything

Explore the biggest library of insights. And we've infused it with powerful filtering tools so you can easily find what you need.

Knowledge Library

Powerful Saving & Organizational Tools

Save ideas for later reading, for personalized stashes, or for remembering it later.

# Personal Growth

Take Your Ideas

Anywhere

Organize your ideas & listen on the go. And with Pro, there are no limits.

Listen on the go

Just press play and we take care of the words.

Never worry about spotty connections

No Internet access? No problem. Within the mobile app, all your ideas are available, even when offline.

Get Organized with Stashes

Ideas for your next work project? Quotes that inspire you? Put them in the right place so you never lose them.

Join

2 Million Stashers

4.8

5,740 Reviews

App Store

4.7

72,690 Reviews

Google Play

Sean Green

Great interesting short snippets of informative articles. Highly recommended to anyone who loves information and lacks patience.

samz905

Don’t look further if you love learning new things. A refreshing concept that provides quick ideas for busy thought leaders.

Shankul Varada

Best app ever! You heard it right. This app has helped me get back on my quest to get things done while equipping myself with knowledge everyday.

Ashley Anthony

This app is LOADED with RELEVANT, HELPFUL, AND EDUCATIONAL material. It is creatively intellectual, yet minimal enough to not overstimulate and create a learning block. I am exceptionally impressed with this app!

Jamyson Haug

Great for quick bits of information and interesting ideas around whatever topics you are interested in. Visually, it looks great as well.

Laetitia Berton

I have only been using it for a few days now, but I have found answers to questions I had never consciously formulated, or to problems I face everyday at work or at home. I wish I had found this earlier, highly recommended!

Giovanna Scalzone

Brilliant. It feels fresh and encouraging. So many interesting pieces of information that are just enough to absorb and apply. So happy I found this.

Ghazala Begum

Even five minutes a day will improve your thinking. I've come across new ideas and learnt to improve existing ways to become more motivated, confident and happier.

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving & library

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Personalized recommendations

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates