Questions tagged [spaces]

The space character, `U+0020`, used to separate words/tokens in most natural and programming languages.

The space character, U+0020, used to separate words/tokens in most natural and programming languages. Space is a whitespace character.

Spaces are frequently of concern to programmers in the context of languages with significant whitespace (e.g. Python), source code indentation, and separating tokens. Separating tokens correctly is important for shell scripts, URIs, file names/paths, text processing, and string formatting. Questions regarding all of these areas are common on Stack Overflow, as spaces appearing unexpectedly can cause unexpected behavior whose source is not immediately obvious.

"Spaces" may also refer to the virtual desktop functionality of Mac OS X, first referred to as "Spaces" in OS X 10.5.

1024 questions
65
votes
7 answers

Handle spaces in argparse input

Using python and argparse, the user could input a file name with -d as the flag. parser.add_argument("-d", "--dmp", default=None) However, this failed when the path included spaces. E.g. -d C:\SMTHNG\Name with spaces\MORE\file.csv NOTE: the…
ofer.sheffer
  • 5,417
  • 7
  • 25
  • 26
58
votes
4 answers

How do you import a file in python with spaces in the name?

Do I have to take out all the spaces in the file name to import it, or is there some way of telling import that there are spaces?
lilfrost
  • 590
  • 1
  • 4
  • 7
56
votes
2 answers

NSWindow with NSWindowCollectionBehaviorStationary is visible on the Dashboard. Is this a bug?

I'm trying to get my NSWindow to: Be visible on all Spaces Be visible when showing the Desktop (by pressing F11) Not be visible in Mission Control/Expose The following does exactly that, but with a side effect: [self setCollectionBehavior:…
Mark
  • 6,647
  • 1
  • 45
  • 88
56
votes
5 answers

Bash variables with spaces

I'm facing the next problem in MinGW shell under windows. I have in my /etc/profile the expression: export GIT_SSH="/c/Program Files/TortoiseGit/bin/TortoisePlink.exe" This doesn't work when I use git fetch on the local repository. But if I do it…
INS
  • 10,594
  • 7
  • 58
  • 89
56
votes
16 answers

Remove spaces from a string in C

What is the easiest and most efficient way to remove spaces from a string in C?
Tyler Treat
  • 14,640
  • 15
  • 80
  • 115
51
votes
5 answers

Remove Unicode characters from textfiles - sed , other Bash/shell methods

How do I remove Unicode characters from a bunch of text files in the terminal? I've tried this, but it didn't work: sed 'g/\u'U+200E'//' -i *.txt I need to remove these Unicode characters from the text files: U+0091 - sort of weird "control"…
alvas
  • 115,346
  • 109
  • 446
  • 738
50
votes
9 answers

OSX Lion AppleScript : How to get current space # from mission control?

I'm trying to figure out how to get the current space # from mission control. Source would be helpful, but more helpful would be info on how to figure this out myself. I've written a few applescripts, but more often than not it seems like any time…
user578895
50
votes
2 answers

Indenting heredocs with spaces

For personal development and projects I work on, we use four spaces instead of tabs. However, I need to use a heredoc, and I can't do so without breaking the indention flow. The only working way to do this I can think of would be this: usage() { …
IBPX
  • 681
  • 1
  • 6
  • 11
47
votes
7 answers

Adding spaces in multiple lines simultaneously - in Pycharm

I occasionally need to go line-by line and change the indentation of the code. Is there a shortcut in Pycharm where I can add spaces (format the indent) in the begining of multiple lines simultaneously without processing each line individually?
user1396713
  • 515
  • 1
  • 4
  • 8
46
votes
5 answers

Deleting tabs when using tabs as spaces

I know that the general tabs vs spaces thing is as old as the hills and mostly comes down to personal preference/sticking to the style of your team, I just wanted to ask a practical question about using spaces in Visual Studio. There are certain…
identitycrisisuk
  • 906
  • 1
  • 9
  • 15
45
votes
2 answers

I don't want spaces when I tab in visual studio 2010

Whenever I add a tab in VS 2010, it puts spaces instead. I know you could fix this problem by going in the VS 2008 options, but I can't figure out how to fix this in VS 2010.
Jello
  • 551
  • 1
  • 5
  • 12
40
votes
7 answers

Python's interpretation of tabs and spaces to indent

I decided, that I learn a bit of Python. The first introduction says that it uses indentation to group statements. While the best habit is clearly to use just one of these what happens if I interchange them? How many spaces will be considered equal…
Lukas
  • 2,232
  • 3
  • 21
  • 34
40
votes
8 answers

How to copy directories with spaces in the name

I am trying to use robocopy but am unable to make it work because of spaces in the directory names. I am trying to copy 3 directories: My Documents, My Music and My Pictures to 'C:\test-backup' but want the end result to be 'C:\test-backup\My…
Angie
  • 871
  • 2
  • 10
  • 18
39
votes
4 answers

Git Merge and Fixing Mixed Spaces and Tabs with two Branches

I've gone through some similar SOQ's and have not seen an adequate solution for this case. I've noticed that in many files there is a dirty mix of tabs and spaces used for indenting. The coding standard we follow uses 4 spaces for a tab…
Bryan Ruiz
  • 2,555
  • 5
  • 29
  • 35
34
votes
8 answers

How to cin Space in c++?

Say we have a code: int main() { char a[10]; for(int i = 0; i < 10; i++) { cin>>a[i]; if(a[i] == ' ') cout<<"It is a space!!!"<
Narek
  • 38,779
  • 79
  • 233
  • 389
1
2
3
68 69