[Solved] how to make a new line before a digit in a string [closed]

Use regex a=”HOW TO COOK RICE – Chapter 1: 1 rinse water once 2 add one and a half cup of water for every cup of rice 3 cover the pot and simmer” idx=[i.start() for i in re.finditer(‘(\d{1,} \w{1,})’, a)] if idx: print(a[:idx[0]]) else: print(a) for i,index in enumerate(idx): if not i==len(idx)-1: print(a[index:idx[i+1]]) else: print(a[idx[i]:]) … Read more

[Solved] How to browse the document file in iOS [closed]

Two things you can consider: 1. If you have to give permission for sharing document directory in your .plist. Then traverse through file app. 2. Or you have to use UIDocumentBrowserViewController and show list of file and directory. Please check this link : https://developer.apple.com/documentation/uikit/uidocumentbrowserviewcontroller 1 solved How to browse the document file in iOS [closed]

[Solved] Tower of Hanoi – User is moving disks (c)

You may make 2d array representing 3 poles. Get input from user and initialize arr[2][number] = {0}; for(i=0; i<number; i++){ arr[0][i] = number-i; } And start a loop which helps user to input 2 numbers and operate moving. You need to check several conditions like if k > l, arr[x][k] < arr[x][l] where x, k, … Read more

[Solved] Open and read all text Files in your directory and filter them using regular expression, python

This is using glob rather than listdir, but this might be a possible method. No regular expressions involved here either though. import glob folder_path = “C:\Temp” file_pattern = “\*.txt” search_string = “hello” match_list = [] folder_contents = glob.glob(folder_path + file_pattern) for file in folder_contents: print(“Checking”, file) read_file = open(file, ‘rt’).read() if search_string in read_file: match_list.append(file) … Read more

[Solved] Python GUI – Calculator drop-down menu [closed]

It took some effort, but here goes: from tkinter import * from tkinter.ttk import * def left_side(): “””Left “”” global left_entry, right_entry, answer_label, integer_combo left_entry.get() def right_side(): “””Right””” global left_entry, right_entry, answer_label, integer_combo right_entry.get() def combo_calc(): “””Combobox basic Calculator””” global left_entry, right_entry, answer_label, integer_combo if integer_combo.get() == “+”: answer_label[‘text’] = str(int(left_entry.get()) + int(right_entry.get())) elif integer_combo.get() … Read more

[Solved] Linux ‘cut’ command line and replace

This should do the trick: #!/bin/bash INPUT=”$@” SIZE=${#INPUT} for ((i=0; i < ${SIZE}; i++)); do echo “${INPUT}” INPUT=”${INPUT:0:${i}} ${INPUT:$((i+1)):${SIZE}}” #INPUT=”$(echo “$INPUT” | sed “s/^\(.\{${i}\}\)./\1 /”)” done I added a sed option in the comment, although it creates a sub-process when you don’t really have to. 0 solved Linux ‘cut’ command line and replace

[Solved] IF statement have an issue. JavaScript

You need to call your function like: mojaFunkcija(); in order to execute it. Also use other methods of inserting HTML content instead of document.write (which is bad practice). var kripta = “sveta”; var vatra = “kralj”; var predstava = “odlicno”; function mojaFunkcija(){ alert(“Ja imam para!”); } if ( (kripta==”sveta”) && (vatra==”kralj”) && (predstava==”odlicno”)){ document.body.innerHTML = … Read more

[Solved] Android Development Layout

Try this <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent” android:background=”@color/background”> <RelativeLayout android:layout_width=”match_parent” android:layout_marginBottom=”10dp” android:layout_marginTop=”5dp” android:background=”@color/black” android:layout_marginRight=”5dp” android:layout_marginLeft=”10dp” android:layout_height=”match_parent”> <RelativeLayout android:layout_alignParentBottom=”true” android:layout_width=”match_parent” android:background=”@color/cost” android:layout_height=”60sp”/> </RelativeLayout> 1 solved Android Development Layout