lines

Remove lines from a file starting with a space, including empty lines

巧了我就是萌 提交于 2021-02-08 05:46:16
问题 To delete all lines of a txt file that begins with a space (including empty lines), I write findstr /v /b /c:" " <%1>result.out. Indeed, result.out file get answer for me if there is no longer both space at beginning of every line and empty line. What I have done still leaving lines header empty, it also preserves blank lines what i want to give up. Finally, the result.out output must have consecutive lines always containing a text at begining of each line. Please someone could tell me what

Draggable lines select one another in Matplotlib

人盡茶涼 提交于 2021-02-07 17:58:39
问题 I'm trying to create a class of draggable lines using matplotlib handling and picking. The aim is to set different thresholds and intervals on a graph. Here is the code: import matplotlib.pyplot as plt import matplotlib.lines as lines import numpy as np class draggable_lines: def __init__(self, ax, kind, XorY): self.ax = ax self.c = ax.get_figure().canvas self.o = kind self.XorY = XorY if kind == "h": x = [-1, 1] y = [XorY, XorY] elif kind == "v": x = [XorY, XorY] y = [-1, 1] else: print(

Draggable lines select one another in Matplotlib

橙三吉。 提交于 2021-02-07 17:58:29
问题 I'm trying to create a class of draggable lines using matplotlib handling and picking. The aim is to set different thresholds and intervals on a graph. Here is the code: import matplotlib.pyplot as plt import matplotlib.lines as lines import numpy as np class draggable_lines: def __init__(self, ax, kind, XorY): self.ax = ax self.c = ax.get_figure().canvas self.o = kind self.XorY = XorY if kind == "h": x = [-1, 1] y = [XorY, XorY] elif kind == "v": x = [XorY, XorY] y = [-1, 1] else: print(

Draggable lines select one another in Matplotlib

半腔热情 提交于 2021-02-07 17:57:33
问题 I'm trying to create a class of draggable lines using matplotlib handling and picking. The aim is to set different thresholds and intervals on a graph. Here is the code: import matplotlib.pyplot as plt import matplotlib.lines as lines import numpy as np class draggable_lines: def __init__(self, ax, kind, XorY): self.ax = ax self.c = ax.get_figure().canvas self.o = kind self.XorY = XorY if kind == "h": x = [-1, 1] y = [XorY, XorY] elif kind == "v": x = [XorY, XorY] y = [-1, 1] else: print(

sed: conditional merge of multiple lines

与世无争的帅哥 提交于 2021-02-06 12:51:11
问题 I need to merge line of a file using sed based on a pattern. eg: Input File: X1 A B C D E F \+ G H I J 1 \+ LK T PP E OO 2 X2 DDF F Y \+ J W Q .... OutPut Expected: X1 A B C D E F G H I J 1 LK T PP E OO 2 X2 DDF F Y J W Q .. I would like to equivalent of wat is possible in vi editor (:%s/\n+/ /g) Searching the web I found a solution, which logically should have worked sed -e '{:a; N; s/\n+/ /g; ta}' infile But this command defies my understanding and logic, and has produced output X1 A B C D

Limit numbers of lines in TextView

*爱你&永不变心* 提交于 2021-02-05 17:54:22
问题 I have a scrollable textView, and I want to limit the number of lines displayed, however xml properties are not working : <TextView android:id="@+id/tv_addesc" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="vertical" android:maxLines="12" android:textColor="#FFFFFFFF" android:textSize="15sp" /> the number of lines displayed is 50 and there are 900 chars in the text. How can I limit the number of lines displayed and make it scrollable ? Edit : I

Limit numbers of lines in TextView

谁说我不能喝 提交于 2021-02-05 17:53:37
问题 I have a scrollable textView, and I want to limit the number of lines displayed, however xml properties are not working : <TextView android:id="@+id/tv_addesc" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="vertical" android:maxLines="12" android:textColor="#FFFFFFFF" android:textSize="15sp" /> the number of lines displayed is 50 and there are 900 chars in the text. How can I limit the number of lines displayed and make it scrollable ? Edit : I

Limit numbers of lines in TextView

跟風遠走 提交于 2021-02-05 17:52:47
问题 I have a scrollable textView, and I want to limit the number of lines displayed, however xml properties are not working : <TextView android:id="@+id/tv_addesc" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="vertical" android:maxLines="12" android:textColor="#FFFFFFFF" android:textSize="15sp" /> the number of lines displayed is 50 and there are 900 chars in the text. How can I limit the number of lines displayed and make it scrollable ? Edit : I

Plot /draw maze-like lines with Python?

假如想象 提交于 2021-01-29 10:27:24
问题 New to programming, I am trying to plot road boundary-like lines. Basically, I am creating something like a road map and I want a rectangle to always be moving through the trajectory (I mean, the x, y coordinates of the rectangle increase with relation to the lines). The idea is like the image below. Can anyone help me? How do I create and plot the red lines as well as the black rectangle which is moving in the direction of the arrows? UPDATE: I need to check that the distance from the

C - Counting words, characters and lines in file. Character count

烂漫一生 提交于 2021-01-28 00:57:48
问题 I have to write a code in C, which outputs the number of characters, lines and words in a given file. The task seems to be simple, but I'm really not sure what went wrong at this point. So, here's the code: #include <stdio.h> #include <stdlib.h> #include <ctype.h> int main() { FILE *file; char filename[256]; char ch; char prevch; int lines=0; int words=0; int characters=0; printf("Enter your filename (don't forget about extension!):\n"); scanf("%s", filename); file=fopen(filename, "r"); if